#pragma once
#include "IGameState.h"
#include "GameStateManager.h"
#include "TextBox.h"
#include "KeyLock.h"
#include "Menu.h"
#include "StatePlaying.h"
#include "testUnit.h"

#include <string>
#include <vector>
namespace game
{
	class StateIntroScreen2:public IGameState
	{
		Menu* _menu;
	public:
		bool _loaded;
		GameStateManager * _manager;

		~StateIntroScreen2(){delete _menu;}
		StateIntroScreen2(game::GameStateManager *gsm)
		{
			_loaded = false;
			_manager = gsm;
		}

		game::GameStateManager * getManager(){return _manager;}
		bool isLoaded(){return _loaded;}
		bool isTransparent(){return false;}
		void Load()
		{
			std::vector<TextBox*> tb; tb.reserve(4);

			tb.push_back(new TextBox("New Game","Starts a new game",14,sf::Vector2u(0,0),sf::Vector2u(128,16)));
			tb.push_back(new TextBox("Load Game","",14,sf::Vector2u(0,16),sf::Vector2u(128,16)));
			tb.push_back(new TextBox("Settings","",14,sf::Vector2u(0,32),sf::Vector2u(128,16)));
			tb.push_back(new TextBox("Exit Game","",14,sf::Vector2u(0,48),sf::Vector2u(128,16)));

			_menu = new Menu(tb,getManager()->getInput(),getManager()->getRenderWindow());
			_loaded = true;
		}
		void Update()
		{
			_menu->Update();	//only allowed one call to IsButtonPressed per button per frame//
			if (_menu->isSelected())
			{
				if (_menu->getChoice() == "New Game")
				{
					_manager->ChangeState(new game::StatePlaying(getManager()));
				}
				else if(_menu->getChoice() == "Load Game")
				{

				}
				else if(_menu->getChoice() == "Settings")
				{
				
				}
				else if(_menu->getChoice() ==  "Exit Game")
				{
					_manager->getRenderWindow()->close();
				}
			}
			
		}
		void Draw()
		{
			_menu->Draw();
		}

	};

}